﻿Imports System.Windows.Forms

Public Class SetIDDialog

    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        Try
            Main.DeviceID = DeviceIDTextBox.Text.ToString
            Main.ProfileID = ProfileIDTextBox.Text.ToString
            Main.ConsoleID = ConsoleIDTextBox.Text.ToString

            Dim FileString As String = "Config.ini"
            'Write Settings to file
            My.Computer.FileSystem.WriteAllText(FileString, "DeviceID = " & Main.DeviceID & vbCrLf & "ProfileID = " & Main.ProfileID & vbCrLf & "ConsoleID = " & Main.ConsoleID & vbCrLf, False)
        Catch ex As Exception

        End Try

        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Private Sub SetIDDialog_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Load ID's into the textboxes
        DeviceIDTextBox.Text = Main.DeviceID
        ProfileIDTextBox.Text = Main.ProfileID
        ConsoleIDTextBox.Text = Main.ConsoleID
    End Sub
End Class
